#!/bin/bash
set -e

source $(dirname $0)/version

cd $(dirname $0)/..

mkdir -p bin
[ "$(uname)" != "Darwin" ] && LINKFLAGS="-extldflags -static -s"
echo "Building $PKG/e2e ..."
VERSIONFLAGS="-X ${PKG}/pkg/version.Version=${VERSION} -X ${PKG}/pkg/version.GitCommit=${COMMIT:0:8}"
CGO_ENABLED=0 GOARCH=$ARCH go test -c -ldflags "$VERSIONFLAGS $LINKFLAGS" -o bin/system-upgrade-controller.test ./e2e/suite/...
